package com.xxxx.seckill.controller;


import com.xxxx.seckill.VO.OrderDetailVO;
import com.xxxx.seckill.VO.ResponseBean;
import com.xxxx.seckill.VO.ResponseBeanEnum;
import com.xxxx.seckill.pojo.User;
import com.xxxx.seckill.service.IOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 * 订单表 前端控制器
 * </p>
 *
 * @author Jack
 * @since 2024-04-06
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private IOrderService orderService;

    /**
     * 功能描述：订单详情
     *
     * @param user:
     * @param orderId:
     * @return :
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseBean detail(User user, Long orderId) {
        if (null == user) {
            return ResponseBean.error(ResponseBeanEnum.USER_NOT_EXISTS);
        }
        OrderDetailVO orderDetailVO = orderService.detail(orderId);
        return ResponseBean.success(orderDetailVO);
    }
}
